<!--#include file="functions.asp" -->
<%

'set cn=Server.CreateObject("ADODB.Connection")
'cn.Open "MP2ENTTEST2", "MP2", "MP2"

dim sql

For i = 1 to request("Incr")-1
	if (request("seqnum"&i) <> "0") then
	  sql = "UPDATE EXIUSERCOORD SET "
	  sql = sql & "EMPCODE='" & request("empcode"&i) & "',"
'	  sql = sql & "UCNAME='" & request("UserID"&i) & "',"
	  sql = sql & "DEPARTMENT='" & request("dept"&i) & "',"
	  sql = sql & "FULLNAME='" & request("fname"&i) & "',"
	  sql = sql & "ISDEFAULT='" & request("fdefault"&i) & "'"
	  sql = sql & " WHERE SEQNUM=" & request("seqnum"&i)
	  cn.execute(sql)
	else
	  if (request("UserID"&i) <> "") then
'	    sql = "INSERT INTO EXIUSERCOORD(EMPCODE,UCNAME,DEPARTMENT,FULLNAME,ISDEFAULT) VALUES ('"
	    sql = "INSERT INTO EXIUSERCOORD(EMPCODE,DEPARTMENT,FULLNAME,ISDEFAULT) VALUES ('"
	  	sql = sql & request("empcode"&i) & "','"
'		sql = sql & request("UserID"&i) & "','"
	  	sql = sql & request("dept"&i) & "','"
	  	sql = sql & request("fname"&i) &  "')"
		sql = sql & request("fdefault"&i) &  "')"
	  cn.execute(sql)
	  end if
	end if
	
	Next
'end if
response.redirect "Adm_UC.asp"
%>